import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:umeng_push_demo/model/local_notifications.dart';
import 'package:umeng_push_demo/model/push_manager.dart';
import 'package:umeng_push_demo/model/sqlite_manager.dart';

import 'app.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // 强制竖屏
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown
  ]);
  // 设置系统样式
  SystemChrome.setSystemUIOverlayStyle(
      const SystemUiOverlayStyle(
        statusBarColor: Colors.transparent,
      )
  );


  // 请求通知权限
  var status = await Permission.notification.status;
  if (status.isDenied) {
    // 如果权限被拒绝，尝试请求权限
    status = await Permission.notification.request();
  }

  LocalNotifications.initial();
  await PushManager.initial();
  await SqliteManager.shared.initDBContext();
  runApp(const App());
}


